unit uPay;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, cxGraphics, cxControls, cxLookAndFeels,
  cxLookAndFeelPainters, cxContainer, cxEdit, dxSkinsCore, dxSkinBlack,
  dxSkinBlue, dxSkinBlueprint, dxSkinCaramel, dxSkinCoffee, dxSkinDarkRoom,
  dxSkinDarkSide, dxSkinDevExpressDarkStyle, dxSkinDevExpressStyle, dxSkinFoggy,
  dxSkinGlassOceans, dxSkinHighContrast, dxSkiniMaginary, dxSkinLilian,
  dxSkinLiquidSky, dxSkinLondonLiquidSky, dxSkinMcSkin, dxSkinMoneyTwins,
  dxSkinOffice2007Black, dxSkinOffice2007Blue, dxSkinOffice2007Green,
  dxSkinOffice2007Pink, dxSkinOffice2007Silver, dxSkinOffice2010Black,
  dxSkinOffice2010Blue, dxSkinOffice2010Silver, dxSkinPumpkin, dxSkinSeven,
  dxSkinSevenClassic, dxSkinSharp, dxSkinSharpPlus, dxSkinSilver,
  dxSkinSpringTime, dxSkinStardust, dxSkinSummer2008, dxSkinTheAsphaltWorld,
  dxSkinsDefaultPainters, dxSkinValentine, dxSkinVS2010, dxSkinWhiteprint,
  dxSkinXmas2008Blue, Vcl.Menus, Vcl.StdCtrls, cxButtons, cxGroupBox, cxImage,
  cxTextEdit, cxMaskEdit, cxDropDownEdit, cxImageComboBox, cxLabel;

type
  TFrmPay = class(TForm)
    cxImage1: TcxImage;
    cxGroupBox1: TcxGroupBox;
    cxGroupBox2: TcxGroupBox;
    btnSave: TcxButton;
    cbDuration: TcxComboBox;
    Label1: TLabel;
    cbPayType: TcxImageComboBox;
    Label2: TLabel;
    cxLabel1: TcxLabel;
    procedure cbDurationPropertiesChange(Sender: TObject);
    procedure cbPayTypePropertiesChange(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FrmPay: TFrmPay;
  procedure FrmPayShow;

implementation

uses uDm, ucommFunction;

procedure FrmPayShow;
begin
  Application.CreateForm(TFrmPay,FrmPay);
  with FrmPay do
  begin
    dm.crsPay.First;
    while not dm.crsPay.Eof do
    begin
      cbDuration.Properties.Items.Add(dm.crsPay.FieldByName('DURATION').AsString);
      dm.crsPay.Next;
    end;
    cbDuration.ItemIndex:=0;
    ShowModal;
    FreeAndNil(FrmPay);
  end;
end;

{$R *.dfm}

procedure TFrmPay.cbDurationPropertiesChange(Sender: TObject);
begin
  cxImage1.Picture:=nil;
  if dm.crsPay.Locate('DURATION',cbDuration.Text,[]) then
  begin
    if cbPayType.EditValue=1 then
      pGetNetPic(dm.crsPay.FieldByName('wx_url').AsString,cxImage1)
    else
      pGetNetPic(dm.crsPay.FieldByName('alipay_url').AsString,cxImage1);
  end ;

end;

procedure TFrmPay.cbPayTypePropertiesChange(Sender: TObject);
begin
  cbDurationPropertiesChange(nil);
end;

procedure TFrmPay.FormCreate(Sender: TObject);
begin
  pSetCaption(Self);
end;

end.
